#ifndef __TERMINAL_DEVICE_H__
#define __TERMINAL_DEVICE_H__

#include <stdint.h>
#include "dbStatement.h"


typedef struct _TERMINAL_DEVICE{
    int64_t id;
    char name[32];
    int64_t productID;
    int64_t parentID;    
    int64_t protocolID;
    int64_t interfaceID;
    char    nodeID[32];
    char    addr[32];
    int     timeout;
    char    other[256];
    char    desc[256];
    struct _TERMINAL_DEVICE* prev;
    struct _TERMINAL_DEVICE* next; //下一个
}T_TERMINAL_DEVICE;

/**
 * @brief 测点模型
 */
typedef struct _TERMINAL_DEVICE_LIST{
    int  count;
    T_TERMINAL_DEVICE* tail;
    T_TERMINAL_DEVICE* head;
}T_TERMINAL_DEVICE_LIST;


extern void dbTerminalDeviceInit();
extern int  createTerminalDeviceTable();
extern int  insertTerminalDevice(T_TERMINAL_DEVICE* device);
extern int  replaceTerminalDevice(T_TERMINAL_DEVICE* device);
extern int  deleteTerminalDevice(T_TERMINAL_DEVICE* device);
extern int  selectTerminalDevice(const char* sql, T_TERMINAL_DEVICE_LIST* ifList);


#endif // __TERMINAL_DEVICE_H__